package priv.dajie.tzzq.core;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import priv.dajie.tzzq.spider.model.Platform;

public class AutoTakeBack {
    public static void main(String[] args) {
        Logger logger = LogManager.getLogger(AutoTakeBack.class);
        AutoSell autoSell = new AutoSell();
//        autoSell.takeBack(Platform.BUFF);

        while (true) {
            long old = System.currentTimeMillis();

            try {
                autoSell.takeBack(Platform.C5);
                logger.info("从c5取回商品");
            }catch (Exception e){
                logger.error(e);
            }

            try {
                logger.info("从buff取回商品");
                autoSell.takeBack(Platform.BUFF);
            }catch (Exception e){
                logger.error(e);
            }
            if (System.currentTimeMillis()-old<1000*2*60){
                try {
                    Thread.sleep(1000*2*60);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }


        }
    }
}
